1. Field of the Invention
The present invention relates to a data transfer device to transfer data, data transfer method, data transfer program and recording mediums in which the data transfer program is recorded and which can be read by computer.
2. Description of the Related Art
The personal computer (PC) is provided with a variety of interfaces for data communication with peripheral equipment. As shown in FIG. 1, for example, parallel interfaces such as small computer system interface (SCSI) and AT attachment packet interface (ATAPI) are mainly used where PC 101 is connected with a hard disk drive (HDD), and a digital versatile disk read only memory (DVD-ROM) 103 etc.
But in this field, too, serial interfaces such as universal serial bus (USB) interface and the Institute of Electrical and Electronics Engineers (IEEE) 1394 interface have come to be utilized in recent years.
USB interface and IEEE 1394 interface are flexible with regard to the form of connection among devices. Another feature is that each device is connected by the plug-and-play method and there is no need to set ID for each terminal. For this reason, the USB interface, IEEE 1394 interface etc. may be called interfaces highly convenient for end users.
Furthermore, USB interface and IEEE 1394 interface are serial interfaces and it is relatively easy to speed up the data transfer frequency. Because of this, the USB interface and IEEE 1394 interface have achieved relatively high transfer speed.
In the IEEE 1394 interface, serial bus protocol 2 (SBP-2), for example, is used as protocol for data transfer. In SBP-2, an initiator issues a request to a target. The target processes this request and returns a status and data to the initiator. In a combination of PC and peripheral equipment, PC is generally an initiator and the peripheral equipment is a target.
As described in Section 5.2 of the standards of SBP-2, the request is expressed by operation request block (ORB). ORB is prepared in a system memory of the initiator and the target fetches ORB from the initiator. There are a number of kinds of formats of ORB. Command block ORB is used to transfer a command to control the target. A format of command block ORB is shown in FIG. 2.
As shown in FIG. 2, command block ORB includes a field called a command block. In this command block, a command descriptor block (CDB) in SCSI standards, for example, is encapsulated. CDB is used for transfer of a read command or write command etc. A CDB format for 12-byte command is shown in FIG. 3. In the figure, the graduation in the horizontal direction expressed in bits and that in the vertical direction is in bytes.
As shown in FIG. 3, CDB includes a field called an operation code. In this field, a command code is written. In the case of read 10 command, 28 h is written in this field.
CDB includes a field called logical block address, too. In this field, a logic block address is written. In the case of the read command, the address written in this field indicates the read position.
In addition, CDB includes a field called a Transfer Length. In this field, the length of data to be transferred is written. The length of data is generally expressed in the number of blocks. In the case of the read command, what is written in this field is the length of data to be read.
In CDB, as mentioned above, the read position of data and the length of data to be read are written, but no transfer destination of data read out is written.
In other words, in the SCSI standards, when PC makes a read request to peripheral equipment, no transfer destination of data to be read by peripheral equipment is given to peripheral equipment.
In SBP-2, however, a transfer destination of data is written in a field called data_descriptor in the command block ORB. The target peripheral equipment acquires a data transfer destination by fetching a command block ORB from an initiator PC.
In the data_descriptor field of command block ORB, an address at which data is transferred or an address of a page table is written. An example of the address space of PC is shown in FIG. 4.
As shown in FIG. 4, command block ORB, page table and pages are located in this address space. In FIG. 4, in command block ORB, only some fields are shown.
In the page table as shown in FIG. 4, the address of each page and the page length of each page are stored. The target determines whether the address written in data_descriptor is a page table address or not on the basis of page_table_present bit (indicated by p in FIG. 2) of the fetched command block ORB.
If the value of page_table_present bit is 1, what is written in the data_descriptor field is the address of the page table. In this case, the target acquires the values of the data_size field and the page_size field of the fetched command block ORB block.
In the data_size field, the number of pages is written. In this example, the data_size field is 4. Furthermore, in the data_size field, the page length is written. If the value written in this field is 0, it indicates that the page lengths are different from page to page as shown in FIG. 4, for example. If the value in the field is other than 0, it means that the page length is fixed at the written value.
The target acquires the address of each page and the page length of each page from the page table on the basis of the values of the data_descriptor field, the data_size field and the page_size field as shown in FIG. 5.
And the target prepares a data transfer packet for each page on the basis of the page address and the page length acquired of each page and starts to transfer packets one after another.
In SCSI, the target is not informed of data transfer destination, and therefore for a plurality of data to be transferred, a plurality of commands will have to be issued. In SBP-2, only one command may be issued.
That is, it has an advantage that the overhead is reduced when commands are issued from PC.
However, when data are transferred as mentioned above, it is necessary to set a transfer destination for each page, and that reduces the efficiency of data transfer.